package com.wangjiaxong.www;

import java.util.Calendar;
import java.util.Date;

public class SystemTime {
	private static TimeSource timeSource=new SystemTimeSource();
	public static long asMillis(){
		return timeSource.millis();
	}
	public static Calendar asCalendar(){
		Calendar instance = Calendar.getInstance();
		instance.setTimeInMillis(timeSource.millis());
		return instance;
	}
	public static Date asDate(){
		return new Date(timeSource.millis());
	}
	public static void setTimeSource(TimeSource timeSource){
		SystemTime.timeSource=timeSource;
	}
	public static void reset(){
		SystemTime.timeSource=new SystemTimeSource();
	}
}
